package app.models.booking;

import app.models.DaoKit;
import com.github.sog.annotation.TableBind;
import com.github.sog.controller.datatables.core.DatatablesCriterias;
import com.github.sog.plugin.sqlinxml.SqlKit;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

/**
 * <p>
 * 餐桌类型
 * </p>
 *
 * @author Jerry Ou
 * @version 1.0 2014-05-16 23:05
 * @since JDK 1.6
 */
@TableBind(tableName = "ol_dining_table_category")
public class DiningCategory extends Model<DiningCategory> {

    public static final  DiningCategory dao              = new DiningCategory();
    private static final long           serialVersionUID = 4665350514536880941L;

    public Page<Record> datatables(DatatablesCriterias criterias) {
        return DaoKit.paginate("diningtablecategory", criterias);
    }

    public List<DiningCategory> findByBrand(long brand) {
        return find(SqlKit.sql("diningtablecategory.findByBrand"), brand);
    }






















































































































































































































    /**
     * 根据品牌和就餐人数查询出预订的品牌桌位类型
     *
     * @param brand 品牌
     * @param mealNum 就餐人数
     * @return 品牌桌位类型列表
     */
    public List<DiningCategory> findByBrandAndMealNum(long brand, int mealNum) {
        return find(SqlKit.sql("diningtablecategory.findByBrandAndMealNum"), brand, mealNum, mealNum);
    }
}
